Add NIDQ and LF stream support to SpikeGLX reader#5
Merged
stevevanhooser merged 2 commits intomainfrom Apr 13, 2026
Merged
Conversation
The neuropixelsGLX reader previously only handled Imec AP-band streams (.ap.meta/.ap.bin). This adds full support for NIDQ streams (.nidq.meta/.nidq.bin), matching the NDR-matlab reference implementation. Changes: - header.py: Parse snsMnMaXaDw with full MN/MA/XA/DW breakdown. Compute per-bit digital line mapping from niXDBytes1/niXDBytes2. Add niAiRangeMax/Min, niMaxInt, and NI-DAQ gain fields. Also add digital line mapping for IMEC sync words (16 bits per sync column). - neuropixelsGLX.py: Rewrite filenamefromepochfiles() to find .bin first and derive .meta (matching MATLAB), allowing mixed AP+NIDQ epoch lists. Update getchannelsepoch() to expose individual digital lines via n_digital_lines. Update readchannels_epochsamples() digital_in to extract single bits from packed digital words using bitwise operations. - Add 39 new tests covering header parsing, channel enumeration, sample reading, and bit extraction for both NIDQ and AP streams. https://claude.ai/code/session_01HEWqAySjSJ6dFeNWJrdsrJ
The test-symmetry workflow tried to check out NDR-matlab at the same branch name as the PR, failing when no matching branch existed. Add a resolve step that checks if the branch exists via git ls-remote and falls back to main. Also fix black formatting and remove unused import. https://claude.ai/code/session_01HEWqAySjSJ6dFeNWJrdsrJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extended the SpikeGLX reader to support NIDQ (NI-DAQ) and LF (low-frequency) streams in addition to the existing AP (action-potential) stream support. This enables reading data from multiple stream types acquired with SpikeGLX software.
Key Changes
Reader (
ndr_reader_neuropixelsGLX)filenamefromepochfiles()to intelligently select the correct.metafile when multiple streams are present by preferring.binfile matching, allowing AP and NIDQ files to coexist in the same epoch file listdi1) to exposing individual digital bit lines (di1..diM), where M depends on the stream type:niXDBytes1/niXDBytes2)readchannels_epochsamples()digital_in branch to extract individual bits from packed digital word columns instead of returning raw sync wordsHeader Parser (
ndr/format/neuropixelsGLX/header.py)snsApLfSy) and NIDQ (snsMnMaXaDw) metadata formatsn_digital_lines: Total number of individual bit lines exposeddigital_line_col: 0-based column offset for each line within the digital word columnsdigital_line_bit: 0-based bit position within the columndigital_line_label: Human-readable labels (e.g., "XD0", "SY0.6")niAiRangeMax/niAiRangeMinmetadata fieldsniMaxIntmetadata fieldniMNGainandniMAGainfieldsTests (
tests/test_neuropixelsGLX.py)Notable Implementation Details
https://claude.ai/code/session_01HEWqAySjSJ6dFeNWJrdsrJ